﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Data.SqlServerCe;

namespace EWS
{
    class getPatientFullData
    {

        public ArrayList FUllData(int id)
        {
            //// Verbinndung aufbauen
            SqlCeConnection conn = new SqlCeConnection(Properties.Settings.Default.EWS_DatabaseConnectionString);
            conn.Open();

            // Commando aufbauen
            SqlCeCommand cmd = conn.CreateCommand();
            cmd.CommandText = @"SELECT * FROM PatientData WHERE fkPaID = id ordert";
            cmd.ExecuteScalar();
            SqlCeDataReader reader = cmd.ExecuteReader();
            ArrayList PData = new ArrayList();
            while (reader.Read() != false)
            {
                PatientList.PatientData tmp = new PatientList.PatientData();
                tmp.Temperatur = float.Parse(reader.GetString(2));
                tmp.Blutdruck = uint.Parse(reader.GetString(3));
                tmp.Puls = uint.Parse(reader.GetString(4));
                tmp.Sauerstoffsaettigung = uint.Parse(reader.GetString(5));
                tmp.Atemfrequenz = uint.Parse(reader.GetString(6));
                tmp.ID = uint.Parse(reader.GetString(0));
                tmp.timestamp = reader.GetString(8);
            }
            return PData;
        }
    }
}
